package org.example.juc.lock;

public class ThreadTest {
    public static void main(String[] args) throws Exception{
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!Thread.interrupted()) {
                }
                System.out.println(Thread.currentThread().getName() + "线程中断");
            }
        });

        thread.start();

        Thread.sleep(1000);

        thread.interrupt();
    }
}
